Skip to content

Conversation

@aKlimau
Copy link

@aKlimau aKlimau commented Nov 4, 2025

Failed task tracebacks are currently a part of task model, it can expose sensitive information from an exception via the API. This change stops this behavior by only logging tracebacks and not storing them inside of tasks.

_execute_task and _aexecute_task are modified to log tracebacks for unknown exceptions but never save them to the Task record.

Task.set_failed() is updated to make the tb (traceback) argument optional.

A new PulpExceptionNoTraceback base class is added for known, user-facing errors (like a DNS failure) where the traceback is not useful and should not be logged.

A new DnsDomainNameException (inheriting from PulpExceptionNoTraceback) is added to handle DNS lookup failures (e.g., bad remote URLs) as a known user error.

Comment on lines 176 to 180
raise ValueError("Immediate tasks must be async functions.")
raise NonAsyncImmediateTaskError(task_name=task.name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this happens, it's a programming error. This should not be user visible.

@aKlimau aKlimau force-pushed the no-traceback-exception branch from 7a4572d to 633d6be Compare November 18, 2025 12:39
@aKlimau aKlimau marked this pull request as draft November 18, 2025 14:07
@aKlimau aKlimau force-pushed the no-traceback-exception branch from 633d6be to 43966ea Compare November 19, 2025 08:54
@aKlimau aKlimau force-pushed the no-traceback-exception branch 6 times, most recently from ffcb19b to 0c2fc24 Compare December 9, 2025 11:47
@aKlimau aKlimau force-pushed the no-traceback-exception branch 4 times, most recently from 53afe18 to 0eec124 Compare December 9, 2025 15:51
@aKlimau aKlimau force-pushed the no-traceback-exception branch from e7d65e1 to ba22c61 Compare December 10, 2025 14:11
@aKlimau aKlimau force-pushed the no-traceback-exception branch from b5de7a3 to cb4fe92 Compare December 10, 2025 14:55
- Raise pulp-glue lower bound due to new imports requiring features from 0.30.0
- Add explicit pycares dependency to fix aiodns compatibility issue
@aKlimau aKlimau force-pushed the no-traceback-exception branch from 673f40c to f10b3ba Compare December 11, 2025 12:24
@aKlimau aKlimau force-pushed the no-traceback-exception branch 5 times, most recently from fc3aef2 to bb355d0 Compare January 7, 2026 10:00
@aKlimau aKlimau force-pushed the no-traceback-exception branch 5 times, most recently from c216476 to bbb4420 Compare January 7, 2026 15:07
tb_str = "".join(traceback.format_tb(tb))
error = exception_to_dict(exc, tb_str)
error = {}
if tb:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still happen? Don't we just want the error to be a single string like:
"Remote URL not found" or "Internal Error"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we maybe instead add the PLP000X codes here?


def __str__(self):
return _("Domain name was not found for {}. Check if specified url is valid.").format(
self.url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not leak urls either...

self.url = url

def __str__(self):
return _("Domain name was not found for {}. Check if specified url is valid.").format(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Domains in the context of Pulp may be misleading. "URL lookup failed." Should be sufficient.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you have a chance, could you please squash the commits where it makes sense? Also, if you want to sync the branch with main, rebasing instead of creating merge commits would help to keep the history clean.

return _("Domain name was not found for {}. Check if specified url is valid.").format(
self.url
)
return _("URL lookup failed.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's more leaked data with the other exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants